(module filter-in (lib "eopl.ss" "eopl")
  (provide filter-in)
;;1.21
;;filter-in: pred lst ==> list
;;usage (filter-in pred lst)
;;produces: 

;;examples
;;(filter-in number? '(a 2 (1 3) b 7)) ==> (2 7)
;;(filter-in symbol? '(a (b c) 17 foo)) ==> (a foo)

(define filter-in
  (lambda (pred lst)
    (cond 
      ( (null? lst) ())
      ((pred (car lst)) (cons (car lst) (filter-in pred (cdr lst))))
      (else (filter-in pred (cdr lst)))
      )
    )
  )
)